<?php
/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2018-07-03
 * Time: 16:48
 */
// 开发允许跨域访问
header('Access-Control-Allow-Origin:*');
class Condition extends MY_Controller
{
    // 用户添加病情,下一步客服分诊CustomerService
    public function add(){
        if (empty($this->getUserByOpenid())) return;
        $conditions = $this->input->post("conditions");

        if (empty($conditions)){
            $res['start'] = 300;
            $res['content'] = '请完整填写请求内容';
            echo json_encode($res,JSON_UNESCAPED_UNICODE);
            return;
        }

        $conditions['inspect_photo'] = implode(",", $conditions['inspect_photo']);
        $conditions['drug_photo'] = implode(",", $conditions['drug_photo']);
        $conditions['createtime'] = date('Y-m-d h:i:sa',time());
        $insertRes = $this->db->insert('condition',$conditions);

        if ($insertRes > 0){
            $res['start'] = 200;
            $res['content'] = '患者添加病情成功';
        }else {
            $res['start'] = 500;
            $res['content'] = '患者添加病情失败';
        }
        echo json_encode($res,JSON_UNESCAPED_UNICODE);
    }


    // 查询病情,级联医生与交互

}